﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using OpenGado.DATA;
using OpenGado.DATA.Entities;
using OpenGado.Business;
namespace OpenGado.Win
{
    public partial class VendorForm : Form
    {
        public VendorForm()
        {
            InitializeComponent();
        }

        private void LoadGrid()
        {
            dgvVendorList.AutoGenerateColumns = false;
            dgvVendorList.DataSource = VendorDataControl.Instance.GetAllVendors();
            // Get the list of vendors 

            
            dgvVendorList.Columns[0].DataPropertyName = "VendorId";
            dgvVendorList.Columns[1].DataPropertyName = "VendorName";
            dgvVendorList.Columns[2].DataPropertyName = "vendorContact";
            dgvVendorList.Columns[3].DataPropertyName = "vendorFax";
            dgvVendorList.Columns[4].DataPropertyName = "vendorWebsite";
            

        }

        private void VendorForm_Load(object sender, EventArgs e)
        {

            LoadGrid();
        }

        private void VendorDetails (int vendorId)
        {
            // Fetch vendor object 
            Vendor vendor = VendorDataControl.Instance.GetbyId(vendorId);
           

            // Fetch contacts 
            IList<Contact> contacts = VendorDataControl.Instance.GetAllContacts(vendorId);

            //for each contact Fetch address list 

            // for each contact Fetch phone list

        }
    }
}
